"use strict";

exports.__esModule = true;
exports.multipleScrollStrategy = multipleScrollStrategy;
var _utils = require("../utils");
/**
 * Scroll strategy for multiple selections.
 *
 * @param {Core} hot Handsontable instance.
 * @returns {function(): function(CellCoords): void}
 */
function multipleScrollStrategy(hot) {
  return cellCoords => {
    const scrollTargetCalc = (0, _utils.createScrollTargetCalculator)(hot);
    const targetScroll = {
      row: scrollTargetCalc.getComputedRowTarget(cellCoords),
      col: scrollTargetCalc.getComputedColumnTarget(cellCoords)
    };
    hot.scrollViewportTo(targetScroll, () => {
      const {
        row,
        col
      } = targetScroll;
      (0, _utils.scrollWindowToCell)(hot.getCell(row, col, true));
    });
  };
}